package com.hjh.springbootdemo.web.hello;

import com.hjh.springbootdemo.web.comm.KtjiaoyuInfo;
import com.hjh.springbootdemo.web.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
public class HelloController {

    @Resource
    private DemoService demoService;
    @Resource
    private KtjiaoyuInfo ktjiaoyuInfo;

    @Value("${name}")
    private String name;
    @Value("${email}")
    private String email;

    @RequestMapping(value = "/hello")
    @ResponseBody
    public String hello(){
        String msg = demoService.sayHello();
//        msg += " "+name+" "+email;
        msg += ktjiaoyuInfo.getName()+ktjiaoyuInfo.getEmail();
        return msg;
    }
}
